package cn.readjava.bean;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

@Entity
@Table(name = "user_role", schema = "readjava", catalog = "")
public class UserRole implements Serializable {
    private long urId;
    private Long uId;
    private Long rId;

    @Id
    @Column(name = "ur_id", nullable = false)
    public long getUrId() {
        return urId;
    }

    public void setUrId(long urId) {
        this.urId = urId;
    }

    @Basic
    @Column(name = "u_id", nullable = true)
    public Long getuId() {
        return uId;
    }

    public void setuId(Long uId) {
        this.uId = uId;
    }

    @Basic
    @Column(name = "r_id", nullable = true)
    public Long getrId() {
        return rId;
    }

    public void setrId(Long rId) {
        this.rId = rId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserRole userRole = (UserRole) o;
        return urId == userRole.urId &&
                Objects.equals(uId, userRole.uId) &&
                Objects.equals(rId, userRole.rId);
    }

    @Override
    public int hashCode() {

        return Objects.hash(urId, uId, rId);
    }
}
